﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class CLIPINFO
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _CLIP_ID = -99;
        private string _CLIP_CAT = "";
        private string _CLIP_TITLE = "";
        private bool _ISDELETED = false;
        private bool _ISACTIVE = true;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public bool ISACTIVE
        {
            get
            {
                return _ISACTIVE;
            }
            set
            {
                _ISACTIVE = value;
            }
        }

        public long CLIP_ID
        {
            get
            {
                return _CLIP_ID;
            }
            set
            {
                _CLIP_ID = value;
            }
        }

        public string CLIP_CAT
        {
            get
            {
                return _CLIP_CAT;
            }
            set
            {
                _CLIP_CAT = value;
            }
        }

        public string CLIP_TITLE
        {
            get
            {
                return _CLIP_TITLE;
            }
            set
            {
                _CLIP_TITLE = value;
            }
        }

        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@CLIP_ID", CLIP_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CLIP_CAT", CLIP_CAT, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@CLIP_TITLE", CLIP_TITLE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                return DAC.Save("CLIPINFO_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long CLIP_ID, string CLIP_CAT, string CLIP_TITLE, bool ISDELETED, bool ISACTIVE, string andor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@CLIP_ID", CLIP_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CLIP_CAT", CLIP_CAT, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@CLIP_TITLE", CLIP_TITLE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4,dbparam5 };
                DataTable dt = DAC.Select("CLIPINFO_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}
